<?php

namespace App\Http\Middleware;

use Closure;
use Framework\BaseService;
use Framework\Hope;
use Illuminate\Http\Request;

class MtIpMiddleware extends BaseService
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        if (!Hope::isProduct()) {
            return $next($request);
        }

        $ip = [
            '118.178.188.212',
            '115.29.176.175'
        ];
        if(in_array($request->getClientIp(),$ip)){
            return $next($request);
        }else{
            $this->retError("无权访问！");
        }

    }
}
